<template>
	<view>
		个人中心
		<u-button @click="goCart">
			购物车
		</u-button>
		<br>
		<block v-if="addr">
			<view class="dt">收货人: </view>
			<view class="dd meta">
				<text class="name">{{addr.userName}}</text>
				<text class="phone">{{addr.telNumber}}</text>
			</view>
			<view class="dt">收货地址:</view>
			<view class="dd">{{addr.details}}</view>
		</block>

		<button type="primary" @click="getAttr">获取地址</button>
       <!-- <open-data type="userNickName">获取信息</open-data> -->
	   <!-- <input type="nickname" class= "weui-input" placeholder="请输入昵称"/> -->
	   <u-avatar :src="src" shape="square" @click="changeavatar"></u-avatar>
       <open-data class="avatar" type="userAvatarUrl"></open-data>
	   <button on-type="choonseAvatar"></button>
	   <input type="nickname" class="weui-input" placeholder="请输入昵称"/>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				addr: {  
					userName:'',
					telNumber:"",
					details:'',
				},
					src: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg'
				                
			}
		},
		methods: {
			goCart() {
				uni.navigateTo({
					url: '/pages/cart/cart'
				});
			},
			// 点击获取地址
		    getAttr(){
		        // API  获取微信端 看到用户地址列表
		        uni.chooseAddress({
		            success:(res)=>{
		                this.addr = res;
		                // 详细地址
		                this.addr.details = res.provinceName+res.cityName+res.countyName+res.detailInfo;
		            }
		        });
		    },
		},

	}
</script>

<style>

</style>
